package io.gitee.zhangbinhub.acp.cloud

import com.fasterxml.jackson.databind.ObjectMapper
import io.gitee.zhangbinhub.acp.boot.AcpComponentAutoConfiguration
import io.gitee.zhangbinhub.acp.cloud.aspect.RestControllerRepeatAspect
import io.gitee.zhangbinhub.acp.cloud.lock.DistributedLock
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean
import org.springframework.context.annotation.Bean

/**
 * @author zhangbin by 2018-3-14 15:13
 * @since JDK 11
 */
@AutoConfiguration(after = [AcpComponentAutoConfiguration::class])
class AcpCloudComponentAutoConfiguration {
    @Bean
    @ConditionalOnBean(DistributedLock::class)
    fun restControllerRepeatAspect(
        distributedLock: DistributedLock,
        objectMapper: ObjectMapper
    ) = RestControllerRepeatAspect(distributedLock, objectMapper)
}
